<template>
    <div class="talkBoxMess">
        <!--添加数据弹出层-->
        <div class="toolbar">
            <Modal
                    v-model="showAddForm"
                    title="添加"
                    :loading="loading"
                    :mask-closable="maskClosable"
                    :closable="false"
            >
                <div slot="header">
                    <div class="ivu-modal-header-inner">添加</div>
                    <a class="ivu-modal-close" @click="cancel"><i class="ivu-icon ivu-icon-ios-close-empty"></i></a>
                </div>
                <Form :model="addData" :label-width="80">
                    <FormItem label="服务器名:">
                        <Input class="modalInput" v-model="addData.villageName" placeholder="服务器名"></Input>
                    </FormItem>
                    <!--                     <FormItem label="图片地址:">
                                            <Input v-model="addData..photos.split(',')[0]" placeholder="请输入图片地址"></Input>
                                        </FormItem> -->
                    <FormItem label="ip地址:">
                        <Input class="modalInput"  v-model="addData.address" placeholder="请输入ip地址"></Input>
                    </FormItem>
                    <FormItem label="部门:">
                        <Input class="modalInput"  v-model="addData.city" placeholder="请输入部门"></Input>
                    </FormItem>
                </Form>
                <div slot="footer">
                    <Button type="primary" size="large" :loading="modalLoading"  @click="ok">确定</Button>
                    <Button size="large" @click="cancel">取消</Button>

                </div>
            </Modal>
        </div>

    </div>
</template>

<script>
  import util from '../libs/util'
  export default {
    name: 'talkBoxMess',
    data () {
      return {
        flag: false,
        loading: true,
        modalLoading:false,
        maskClosable:false,
        addData: {
          'villageName': '',
          'address': '',
          'city': ''
        } //添加的数据
      }
    },
    props: ['showAddForm'],
//    created () {
//      console.log(this.showAddForm)
//      this.flag = this.showAddForm
//    },
    methods: {
      ok () {
//        var self = this;
//        this.$emit("changeShow", self.showAddForm);
        let url = '/react-service/api/houseInfo/getDetail.do'
          /*获取到添加的数据*/
        alert('添加的数据为' + JSON.stringify(this.addData))
        let data = this.addData
        console.log(this.addData)
          /*请求接口*/
        util.ajax.post(url, data).then((res) => {
          console.log(res)
        })
        this.$emit('reset', true)
          /*获取最新数据*/
//        this.getInfo()
      },
      cancel() {
        this.$emit('reset')
      }
    }
  }
</script>


<style scoped>

</style>
